﻿//-----------------------------------------------------------------------
// <copyright file="LoggerTest.cs" company="Panchal Softwares">
//     Copyright (c) Panchal Softwares. All rights reserved.
// </copyright>
// <author>Karn Panchal</author>
//-----------------------------------------------------------------------

/// <summary>
/// Namespace Text Finder Unit Test.
/// </summary>
namespace PanchalSoftwares.TextFinder.UnitTest
{
    using System;
    using System.IO;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using PanchalSoftwares.TextFinder.Library;

    /// <summary>
    /// Class Logger Test.
    /// </summary>
    [TestClass]
    public class LoggerTest
    {
        /// <summary>
        /// Tests the write log.
        /// </summary>
        [TestMethod]
        public void TestWriteLog()
        {
            string log = "Test Text.";            
            string logFileName = "TextFinder.log";
            Logger.WriteLog(log);
            string path = Path.Combine(Environment.CurrentDirectory, logFileName);
            StreamReader reader = new StreamReader(path);
            log = string.Format("{0} - {1}", DateTime.Now, log);
            Assert.AreEqual(reader.ReadToEnd().Contains(log), true);            
        }
    }
}
